<?php
/**
 * CreateTime: 2023/11/24 15:12
 * User:LinQ
 */

namespace App\Http\Controllers\Department;

use App\Http\Controllers\BasicInterfaceController;
use App\Http\Controllers\Controller;
use App\Http\Requests\Department\DepartmentRequest;
use App\Http\Requests\System\ListRequest;
use App\Http\Service\Department\DepartmentService;

class DepartmentController extends Controller implements BasicInterfaceController
{

    public function getList()
    {
        $request = request()->only('page','page_size','filters','desc');
        (new ListRequest())->check($request);
        (new DepartmentService())->getList($request);
    }

    public function getSelect()
    {
        (new DepartmentService())->getSelect();
    }

    public function getSelectHasPage()
    {
        $request = request()->only('page','page_size','filters','desc');
        (new ListRequest())->check($request);
        (new DepartmentService())->getSelectHasPage($request);
    }

    public function getInfo($id)
    {
        (new DepartmentService())->getInfo($id);
    }

    public function create()
    {
        $request = request()->only('department_name','responsible_user_id','pid');
        (new DepartmentRequest())->check($request);
        (new DepartmentService())->create($request);
    }

    public function fakeDelete($id)
    {
        (new DepartmentService())->fakeDelete($id);
    }

    public function delete()
    {

    }

    public function update($id)
    {
        $request = request()->only('department_name','responsible_user_id',"pid");
        $request['department_id'] = $id;
        (new DepartmentRequest())->scene('update')->check($request);
        (new DepartmentService())->update($request);
    }

    public function fakeDeleteByIds($ids)
    {

    }
}
